scripty2

namespace S2.UI

Description

This is the main user interface namespace.

Class methods

  • addBehavior #

    S2.UI.addBehavior(element, behaviorClass[, options]) -> undefined
    • element (Element | Array) – One or more elements on which to apply the behavior.
    • behaviorClass (Class | Array) – One or more subclasses of UI.Behavior. (Not instances!)

    Add a behavior.

  • addClassNames #

    S2.UI.addClassNames(elements, classNames) -> [Element...]
    • elements (Element | Array): An element (or collection of elements).
    • classNames (String | Array): A space-separated string (or array) of class names to add.
  • disableTextSelection #

    S2.UI.disableTextSelection(element) -> Element

    Disables text selection within the element.

  • enableTextSelection #

    S2.UI.enableTextSelection(element) -> Element

    Enables text selection within the element.

  • findFocusables #

    S2.UI.findFocusables(element) -> [Element...]

    Given an element, returns all focusable descendants.

  • getBehavior #

    S2.UI.getBehavior(element, behaviorClass) -> S2.UI.Behavior
  • isFocusable #

    S2.UI.isFocusable(element) -> Boolean
  • isVisible #

    S2.UI.isVisible(element) -> Boolean
  • makeVisible #

    S2.UI.makeVisible(elements, shouldBeVisible) -> [Element...]
    • elements (Element | Array): An element (or collection of elements).
    • shouldBeVisible (Boolean): Whether the given element(s) should be visible.
  • modifierUsed #

    S2.UI.modifierUsed(event) -> Boolean

    Given an event, returns true if at least one modifier key was pressed during the event.

    For the purposes of this function, SHIFT is not considered a modifier key, because of commons shortcuts like SHIFT + TAB.

  • moveHighlight #

    S2.UI.moveHighlight(delta) -> this
    • delta (Number): Number of "slots" to move the highlight. Positive numbers go down; negative numbers go up.
  • removeBehavior #

    S2.UI.removeBehavior(element, behaviorClass) -> undefined
    • element (Element | Array) – One or more elements on which to remove the behavior.
    • behaviorClass (Class | Array) – One or more subclasses of UI.Behavior. (Not instances!)

    Remove a behavior.

  • removeClassNames #

    S2.UI.removeClassNames(elements, classNames) -> [Element...]
    • elements (Element | Array): An element (or collection of elements).
    • classNames (String | Array): A space-separated string (or array) of class names to remove.
  • selectChoice #

    S2.UI.selectChoice([element]) -> this
    • element (Element | Number): The choice to select — either its DOM node or its index. If omitted, will select the highlighted choice.
  • toHTML #

    S2.UI.toHTML() -> String

    Returns the HTML of the instance's element.

  • toString #

    S2.UI.toString() -> String

    Returns the HTML of the instance's element.

Constants

  • FOCUSABLE_ELEMENTS #

    A list of tag names representing elements that are (typically) focusable. Used by S2.UI.isFocusable.